Package be.DAO

Source Code of be.DAO.klantenDAO

package be.DAO;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import be.connectable.Crudable;
import be.entities.Klanten;

public class klantenDAO extends DAOBase implements Crudable<Klanten>{
  private String generalSELECT = "SELECT * FROM bieren";
  @Override
  public void create(Klanten t) throws Exception {
   
  }

  @Override
  public Klanten read(long id) throws Exception {
    ResultSet rs = statement.executeQuery(generalSELECT +" WHERE klantnr="+id);   
    rs.first();
    Klanten klant = makeKlant(rs);           
    return klant;// TODO Auto-generated method stub
  }

  @Override
  public List<Klanten> readAll() throws Exception {
    List<Klanten> klantenLijst = new ArrayList<Klanten>();
    ResultSet rs = statement.executeQuery(generalSELECT);
    while(rs.next()){
      Klanten klant = makeKlant(rs);     
      klantenLijst.add(klant);     
    }   
    close();         
    return klantenLijst;
  }

  @Override
  public void update(Klanten t) throws Exception {
    statement.execute("UPDATE klanten SET ");
   
  }

  @Override
  public void delete(Klanten t) throws Exception {
    // TODO Auto-generated method stub

  }
  private Klanten makeKlant(ResultSet rs ) throws SQLException {
   
    Klanten klant = new Klanten();
    klant.setKlantNr(rs.getInt("klantnr"));
    klant.setKlantNaam(rs.getString("klantnaam"));
    klant.setKlantAdres(rs.getString("klantadres"));
    klant.setKlantPostCode(rs.getString ("klantpostcode"));
    klant.setKlantmail(rs.getString("klantmail"));
    klant.setKlantPassword(rs.getString("password"));
    klant.setKlantStatus(rs.getString("klantstatus"));
    return klant;
  }

 

}
TOP

Related Classes of be.DAO.klantenDAO

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.